package cn.maszy.action.investment;



import org.springframework.beans.factory.annotation.Autowired;

import cn.maszy.common.BaseAction;
import cn.maszy.common.Pager;
import cn.maszy.model.investment.B_T_Ufp_Leave;
import cn.maszy.service.investment.B_T_Ufp_LeaveService;

import net.sourceforge.stripes.action.SessionScope;




@SessionScope
public class LeaveAction extends BaseAction<B_T_Ufp_Leave> {
	/**
	 * 
	 */
	private static final long serialVersionUID = -3506917760033155365L;
	private B_T_Ufp_Leave b_T_Ufp_Leave;
	@Autowired
	private B_T_Ufp_LeaveService b_T_Ufp_LeaveService;
	private String checkIds;
	/*********************class set/get****************************/
	
	public B_T_Ufp_Leave getB_T_Ufp_Leave() {
		return b_T_Ufp_Leave;
	}
	public void setB_T_Ufp_Leave(B_T_Ufp_Leave b_T_Ufp_Leave) {
		this.b_T_Ufp_Leave = b_T_Ufp_Leave;
	}
	public String getCheckIds() {
		return checkIds;
	}
	public void setCheckIds(String checkIds) {
		this.checkIds = checkIds;
	}
	/*******************STRUTS ACTION METHOD*************************/
	/**
	 * 页面查询
	 * @return
	 * @throws Exception
	 */
	public String leaveList() throws Exception {
		pager = new Pager<B_T_Ufp_Leave>(pageNum, numPerPage,orderField,orderDirection);
		pager= b_T_Ufp_LeaveService.selectList(b_T_Ufp_Leave,pager);
		return SUCCESS;
	}
	/**
	 *	页面跳转
	 * @return
	 * @throws Exception
	 */
	public String leaveJump() throws Exception {
		return SUCCESS;
	}
	/**
	 * 新增和修改
	 * @return
	 * @throws Exception
	 */
	public String leaveUpdate() throws Exception {
		int i	=b_T_Ufp_LeaveService.update(b_T_Ufp_Leave);
		if(i>0)
			//目前只有点击提交后关闭
			//return ajaxForwardSuccess(getText("msg.operation.success"), "adminList", "closeCurrent", "investment/adminList");
		//保存不关闭暂时没做
		return ajaxForwardSuccess(getText("msg.operation.success"), "LeaveList","", "forward", "investment/LeaveList");
		return ajaxForwardError(getText("msg.operation.failure"));
	}
	/**
	 * 删除
	 * @return
	 * @throws Exception
	 */
	public String leaveDelete()  throws Exception {
		int i=b_T_Ufp_LeaveService.delete(checkIds);
		if(i>0)
		return ajaxForwardSuccess(getText("msg.operation.success"), "LeaveList","", "forward", "investment/LeaveList");
		return ajaxForwardError(getText("msg.operation.failure"));
	}
	/**
	 * 查询一条数据
	 * @return
	 * @throws Exception
	 */
	public String leaveDetail() throws Exception {
		if(b_T_Ufp_Leave==null){
			b_T_Ufp_Leave=b_T_Ufp_LeaveService.selectOne("");
		}else{
			b_T_Ufp_Leave=b_T_Ufp_LeaveService.selectOne(b_T_Ufp_Leave.getUuid());
		}
		return SUCCESS;
	}
	
}